import requests,json,time,threading

def lists(i,Authorization):
    s=requests.session()
    s.headers['authorization']=Authorization
    s.headers['Origin']='http://iep.nfonline.com.cn'
    s.headers['user-agent']='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.51 Safari/537.36'
    return json.loads(s.get('http://iepmp.soocedu.com/cloud/modular/video?id='+str(i)+'&project_id='+str(project_id)).text)['data']

def study(Authorization,data):
    s=requests.session()
    s.headers['Authorization']=Authorization
    s.headers['user-agent']='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.51 Safari/537.36'
    print(data['title']+':开始')
    for t in range(60,15*60,60):
        try:
            s.post('http://iepmp.soocedu.com/study',{'course_id':data['id'],'current_time': str(t),'modular_id': data['modular_id'],'project_id': str(project_id)})
        except Exception as e:
            print(e)
        time.sleep(60)
    print(data['title']+':完成')

def main(Authorization):
    for i in range(1,8):
        for c in lists(i,Authorization)['list']:
            t =threading.Thread(target=study,args=(Authorization,c))
            t.start()

project_id=input('请输入project_id：')
main(input('输入Authorization：'))